#include "Expand/IPlugin.h"
#include "Network/PackageManager.h"
#include "Network/Packages/MessagePackage.h"
#include "Log.h"

#include "GameSingleton.h"


namespace PocketSurvival
{
    void IPlugin::ChatObj::sendMessage(const std::string &title, const std::string &message)
    {
        if(m_isTerminal == true)
        {
            fmt::print("[{}]:{}\n", title, message);
        }
        else
        {
            std::shared_ptr<MessagePackage> messagePackage = std::make_shared<MessagePackage>(message, m_client);
            messagePackage->nickname = title;
            GameSingleton::packageManager->addSendPackageToQueue(messagePackage);
        }
    }    
}